package str

import "fmt"

func LongestPalindrome409(s string) int {
	m := map[byte]int{}

	for i, _ := range s {
		if _, ok := m[s[i]]; ok {
			m[s[i]]++
		} else {
			m[s[i]] = 1
		}
	}

	fmt.Println(m)

	res := 0

	for _, v := range m {
		if v%2 == 0 {
			res += v
		} else {
			res += v - 1
		}
	}

	if res < len(s) {
		return res + 1
	} else {
		return res
	}

}
